import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
const imageUrl = 'http://fivefu.com.cn'; //登录服务
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  base: process.env.NODE_ENV === 'production' ? '/vue-mobile-hxqui/' : './',
  server:{
    host:'0.0.0.0',
    port: 8080,
    proxy: {
      '/KsCityAuth': {
        target: imageUrl,
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/imageUrl/, 'imageUrl'),
      },

    },
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: '@import "./src/styles/reset.scss";',
      },
    },
  },
  
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
      'assets': fileURLToPath(new URL('./src/assets', import.meta.url)),
      'views': fileURLToPath(new URL('./src/views', import.meta.url)),
      'utils': fileURLToPath(new URL('./src/utils', import.meta.url)),
      'stores': fileURLToPath(new URL('./src/stores', import.meta.url)),
      'router': fileURLToPath(new URL('./src/router', import.meta.url))
    }
  },
  // optimizeDeps: {
  //   include: ['@kangc/v-md-editor/lib/theme/vuepress.js'],
  // },
})
 